#include<bits/stdc++.h>
#include<iostream>
using namespace std;
long gcd(long a,long b);
long a=0,b=0;
long c=0,d=0;
string x,y;
int main(){
	cin>>x>>y;
	int i=0;
	int t=0;
	while(x[i]!='\0'){
		if(t==0) {
		if(x[i]=='/') t=1;
		else a=a*10+(long)(x[i]-'0');
		}
		else if(t==1) {b=b*10+(long)(x[i]-'0');};
		i++;
	};
	i=0;
	t=0;
	while(y[i]!='\0'){
		if(t==0) {
		if(y[i]=='/') t=1;
		else c=c*10+(long)(y[i]-'0');
		}
		else if(t==1) {d=d*10+(long)(y[i]-'0');};
		i++;
	};
	long u1=a*c;
	long u2=b*d;
	long g=gcd(u1,u2);
	cout<<u2/g<<" "<<u1/g;
	return 0;
}
long gcd(long a,long b){
	long c;
	while(a%b!=0){
		c=a%b;
		a=b;
		b=c;
	};
	return b;
}
